package com.ase.redislike.mapstruct.mapper;

import com.ase.redislike.mapstruct.dto.ProductDto;
import com.ase.redislike.mapstruct.po.Product;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author： yuhang
 * @Date： 2021/11/9
 * @Description：产品对象映射
 */
@Mapper
public interface ProductMapper {
    ProductMapper INSTANCE = Mappers.getMapper(ProductMapper.class);

    @Mapping(source = "id",target = "id")
    @Mapping(source = "unitPrice",target = "unitPrice")
    @Mapping(source = "number",target = "number")
    @Mapping(source = "productionDate",target = "productionDate")
    List<ProductDto> toDto(List<Product> productList);

}
